compress
Type
function
Summary
Returns a gzip-compressed string.
Syntax
the compress of <data>
compress(<data>)
Description
Use the compress function to compress data to a smaller size for transmission.
The compress function is the inverse of the decompress function.
The compressed result is typically about half to a third the size of the original data, although different results may be obtained depending on the amount of data and whether it has already been compressed.
The value returned by the compress function consists of binary data and may include control characters, so displaying it on screen or trying to edit it may produce unexpected results. If you use a URL to place the returned data in a file, it's important to use the binfile URL scheme; using the file URL scheme will corrupt binary data.
For technical information about the format used by the compress function, see RFC 1952. The compress function uses the zlib compression library.
Parameters
Name | Type | Description |
---|---|---|
data | string | A string of binary data of any length. |
Examples
compress(URL "file:image.pict")
put compress(field "Outgoing") into URL "binfile:data.gz"
Related
control structure: function
function: compress, decompress
glossary: return, binary file
keyword: URL, inverse, file, binfile, string
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile